"""
chord.exceptions

Defines exceptions that Chord code may raise. These may need to be handled by the appropriate views.
"""

class ChordError(Exception):
    def __init__(self, value):
        self.value = value
    def __str__(self):
        return repr(self.value)

class ChordPreconditionError(ChordError):
    def __init__(self, value):
        self.value = value
    def __str__(self):
        return repr(self.value)

class ChordServerNotActiveError(ChordPreconditionError):
    def __init__(self, value="This operation is only permitted on an active server."):
        self.value = value
    def __str__(self):
        return repr(self.value)

class ChordServerLeavingError(ChordServerNotActiveError):
    def __init__(self, value):
        self.value = value
    def __str__(self):
        return repr(self.value)

